data_path = 'D:/PycharmProjects/pingan_data/'
from lxml import etree

with open(data_path + '3.html', mode='r', encoding='utf-8') as f:
    text = f.read()

tree = etree.HTML(text)
# h1 = tree.xpath('//p[@class="name-main"]/text()')

result_list = []

content_list = tree.xpath('//div[@class="para"]')
for index, item in enumerate(content_list):

    p1 = item.xpath('div[@class="para"]/strong/text()')
    p2 = item.xpath('text()')
    if p1 and p2:
        print(p1, p2)
        i = 0
        while p1 or p2:
            if i == 0:
                result_list.append({'content': p1.pop(0).strip(), 'type': 3})
                result_list.append({'content': p2.pop(0).strip(), 'type': 5})
            else:
                result_list.append({'content': p1.pop(0).strip(), 'type': 4})
                result_list.append({'content': p2.pop(0).strip(), 'type': 5})
            i = i + 1

print(result_list)